from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from src import settings

TableBase = declarative_base()

db_file_name = "database.db"
sqlite_url = f"sqlite:///{settings.PATH_DATA_DIR}/{db_file_name}"


engine = create_engine(sqlite_url, connect_args={"check_same_thread": False})

def init_database():
    TableBase.metadata.create_all(bind=engine)